<?php
/* load includer classes and load config  */
require_once 'class.includer.php';
require_once 'classes/class.Config.php';
require_once 'classes/class.PageLoader.php';

Config::doDefinations();

// test database connection
$db = Db::getInstance();
Db::setDebug(false);

// start session
session_start();

$url_string = '';
if (!isset($_REQUEST['q']) || $_REQUEST['q'] == '' ) {
	$url_string .= 'index';
}
else {
	$url_string .= $_REQUEST['q'];
}

// seperate into segments
if ($request = strstr($url_string, '?'))
	str_replace($request, '', $url_string);

foreach (explode('/', $url_string) as $part)
	$GLOBALS['NAV_PATH']['parts'][] = $part;

unset($_REQUEST['q']);

PageLoader::LoadPage($GLOBALS['NAV_PATH']['parts'][0]);
